package com.huqing.icu.config;

import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description milvus官方sdk
 * @Author huqing
 * @Date 2025/8/24 22:13
 **/
@Configuration
public class MilvusConfig {

    //IP
    @Value("${sdk.milvus.host:}")
    private String host;

    //端口
    @Value("${sdk.milvus.port:}")
    private Integer port;

    @Bean
    public MilvusClientV2 milvusClientV2() {
        String url = "http://" + host + ":" + port;
        ConnectConfig connectConfig = ConnectConfig.builder().uri(url).build();
        return new MilvusClientV2(connectConfig);
    }
}
